package db.document;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import dbservice.document.DocumentDBService;
import po.AccountBookPo;
import po.DocumentPo;
import po.Po;
public abstract  class DocumentDB implements DocumentDBService{
    AccountBookPo book;
	public DocumentDB(AccountBookPo ab){
    	this.book=ab;
    }
	
	@Override
	public abstract  Po add(DocumentPo document);

	@Override
	public  abstract Po update(DocumentPo document);

	@Override
	public  abstract List<DocumentPo> getUnapproval() ;

	@Override
	public  abstract List<DocumentPo> get(DocumentPo from, DocumentPo to);

	@Override
	public abstract Po approve(DocumentPo document);
	
	
	public static String getDocumentId(String prefix,int num) {
		//Random r = new Random();  
		//long code=r.nextInt(10000);
		num++;
	    NumberFormat nf = new DecimalFormat("00000");
	    String _num = nf.format(num);
        String str = new SimpleDateFormat("yyyyMMdd").format(new Date());
        return prefix+"-"+str+"-"+_num;
    }
}